home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
EnigmA Amiga Run 1995 October
/
EnigmA AMIGA RUN 01 (1995)(G.R. Edizioni)(IT)[!][issue 1995-10][Aminet 7].iso
/
Aminet
/
dev
/
gcc
/
ixemul_src.lha
/
ixemul-41.0
/
gnulib-soft-float
/
modf.c
< prev
next >
Wrap
C/C++ Source or Header
|
1994-08-19
|
558b
|
26 lines
#include <inline/mathieeedoubbas.h>
/*
* modf(value, iptr): return fractional part of value, and stores the
* integral part into iptr (a pointer to double).
*/
double
modf (double value, double *iptr)
{
/* if value negative */
if (IEEEDPTst (value) < 0)
{
/* in that case, the integer part is calculated by ceil() */
*iptr = IEEEDPCeil (value);
return IEEEDPSub (*iptr, value);
}
else
{
/* if positive, we go for the floor() */
*iptr = IEEEDPFloor (value);
return IEEEDPSub (value, *iptr);
}
}